<!DOCTYPE html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<svg width="500" height="500">
    <title>Top Level Title</title>
    <rect width="250" height="250" fill="green">
        <title>Second Level Title</title>
    </rect>
</svg>
<script>
testTooltipText(100, 300, "Top Level Title", "Tooltip title of title child under SVG root");
testTooltipText(100, 100, "Second Level Title", "Tooltip title of title child under an element");

function testTooltipText(x, y, expectedText, description) {
    async_test(function(t) {
        window.addEventListener('load', t.step_func_done(function() {
            assert_own_property(window, 'eventSender');
            assert_own_property(window, 'testRunner');
            eventSender.dragMode = false;
            eventSender.mouseMoveTo(x,y);
            assert_equals(testRunner.tooltipText, expectedText);
        }));
    }, description);
}
</script>